<template>
  <div class="breadcrumb">
    <el-breadcrumb class="common-brand" separator-class="el-icon-arrow-right">
      <template v-for="(item,index) in options">
        <el-breadcrumb-item v-if="(options.length == index+1)" :key="index">
          {{$t(`lang.${item.indexName}`||`cm.${item.indexName}`)}}
        </el-breadcrumb-item>
        <el-breadcrumb-item v-else :key="index" >
          <span class="breadcrumb-is-action" @click="go(item.index)">{{$t(`lang.${item.indexName}`)}}</span>
        </el-breadcrumb-item>
      </template>
    </el-breadcrumb>
  </div>
</template>
<script>
import {COMMON} from '@/utils/commonUtil'
export default {
  /**
   * 页面导航
   */
  name: 'Breadcrumb',
  props: {
    options: {
      type: Array,
      default: () => { return [] }
    }
  },
  data () {
    return {
    }
  },
  methods: {
    go (index) {
      if (!COMMON.isNullOrUndefinedOrSpace(index)) COMMON.routerTo(`${index}`, this.$router)
    }
  }
}
</script>
<style lang="scss">
.breadcrumb {
  height: 40px;
  border-bottom:1px dashed $--border_color;
  .common-brand {
    margin-left: 15px;
    padding-top: 13px;
    .breadcrumb-is-action:hover {
      cursor: pointer;
    }
  }
}
</style>
